#include<bits/stdc++.h>
using namespace std;
int a[100005];
bool vis[100005],att[100005];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    int n;
    cin>>n;
    int x=0,y=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]==1)x++;
        else if(a[i]==2)y++;
    }
    if(x+y==n){
        if(y>=x)cout<<y;
        else cout<<y+x-y;
        return 0;
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++){
        if(vis[i])continue;
        for(int j=i;j<=n;j++){
            if(a[i]<a[j]&&!att[j]&&!vis[j]){
                vis[i]=1;
                att[j]=1;
                break;
            }
        }
    }
    int cnt=0;
    for(int i=1;i<=n;i++){
        if(!vis[i])cnt++;
    }
    cout<<cnt;
    return 0;
}
